<template>
  <div style="display: flex; align-items: center">
    <el-select filterable v-model="aiType" style="width: 220px">
      <el-option label="增值税发票" value="1"></el-option>
      <el-option label="定额发票" value="2"></el-option>
      <el-option label="机打通用发票" value="6"></el-option>
      <el-option label="火车票" value="3"></el-option>
      <el-option label="出租车票" value="4"></el-option>
      <el-option label="飞机票" value="5"></el-option>
      <el-option label="过路过桥费发票" value="7"></el-option>
      <el-option label="购物小票" value="8"></el-option>
    </el-select>
    <el-button type="success" style="margin-left: 10px" @click="aiCheck()">
      AI识别
    </el-button>
  </div>
</template>
<script>
import { ticketIdentify } from '@/api/common/baiduAI'
export default {
  props: ['file'],
  data: function () {
    return {
      aiType: '1',
    }
  },
  methods: {
    aiCheck() {
      if (!this.file) {
        this.$message('请上传文件')
        return
      }
      let formData = new FormData()
      formData.append('image', this.file)
      ticketIdentify(this.aiType, formData).then(({ data }) => {
        this.$emit('output', data)
      })
    },
  },
  created: function () {},
}
</script>
<style>
.el-drawer.rtl {
  overflow: scroll;
}
</style>
<style scoped>
.header {
  width: 100%;
  padding: 10px;
  height: auto;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  background: #ffffff;
  border-radius: 5px;
  border-bottom: #f4f8ff 2px solid;
  display: flex;
  margin-bottom: 11px;
  align-items: center;
}
.main {
  height: calc(100%);
}
